#include "Mcu.h"

void Mcu::readMainframeMcuVersionAction(Frame *frame)
{
    QByteArray info;

    g_mcuVersion.mcuAppVersion.clear();
    g_mcuVersion.mcuBootVersion.clear();

    info.clear();
    for (int8_t i = 0; i < BOOTLOADER_VERSION_SIZE; i++) {
        info.append(frame->data[i]);
    }
    g_mcuVersion.mcuBootVersion.append(info);

    info.clear();
    for (int8_t i = 0; i < APP_VERSION_SIZE; i++) {
        info.append(frame->data[BOOTLOADER_VERSION_SIZE + i]);
    }
    g_mcuVersion.mcuAppVersion.append(info);

    emit reportMcuVersionSignal(&g_mcuVersion);
}

void Mcu::mainframeMcuUpdateRequestAction(Frame *frame)
{
    if (frame->to & MainframeArm) {
        emit mainframeMcuUpdateRequestSignal();
    }
}


